package com.xhui.vimarket.zkplus.zul.attr.ada.impl;

import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Doublebox;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Timebox;
import org.zkoss.zul.Tree;
com.xhui.vimarket.zkplusui.vimarket.zkplus.util.Compcom.xhui.vimarket.zkplusrt com.xhui.vimarket.zkplus.zulcom.xhui.vimarket.zkplusda;
import com.xhui.vimarket.zkpcom.xhui.vimarket.zkplusan.AttrTmpl;
import com.xhui.vimarket.zkpcom.xhui.vimarket.zkplusan.impl.AttrTmplImpl;
import com.xhui.vimarket.zkplus.zul.textbox.TextboxPlus;

/**
 * 产品属性适配器.
 * 取空属性实例方案：全部不生成
 * 按钮文本，composer方案：采用默认的值显示和设置composer,或根据传入的值设置
 * checkbox，composer方案：采用无composer
 * 
 * @author wuyx
 * @version Revision 1.0.0
 * 
 */
public class ProdAttrAda extends DefaultRtimeAttrAda {
    
    /**
     * ins.
     */
    private static AttrAda ins = new ProdAttrAda();
    
    /**
     * instance.
     * @return AttrAda
     */
    public static AttrAda instance() {
        return ProdAttrAda.ins;
    }
    
    /**
     * 构造函数.
     */
    protected ProdAttrAda() {
    }
    
    @Override
    public Component getAttrTmplCompStr(final String displayMode, final AttrTmpl attrTmpl,
        final String sComposer, final String param1, final String param2, Component parentComp) {
        if (AttrTmplImpl.MODE_SELECTLIST.equals(displayMode)) {
            Listbox listbox = new Listbox();
           com.xhui.vimarket.zkplusindComposer(listbox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrListboxComposer", parentComp);
      com.xhui.vimarket.zkplusstbox;
            // return "<listbox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrListboxComposer\" />";
        } else if (AttrTmplImpl.MODE_DATE.equals(displayMode)) {
            Datebox datebox = new Datebcom.xhui.vimarket.zkplus    ComposerUtil.bindComposer(datebox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDateComposer", pacom.xhui.vimarket.zkplus         return datebox;
            // return "<datebox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDateComposer\" />";
        } else if (AttrTmplImpl.MODE_DATETIME.equals(displayMode)) {
            Datebox dcom.xhui.vimarket.zkplustebox();
            ComposerUtil.bindComposer(datebox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.Attcom.xhui.vimarket.zkplus parentComp);
            return datebox;
            // return "<datebox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDateComposer\" />";
        } else if (AttrTmplImpl.MODE_TEXT.equals(displayMode)) {
            Textboxcom.xhui.vimarket.zkpluss = new TextboxPlus();
            ComposerUtil.bindComposer(textboxPlus,
                "com.xhui.vimarket.zkplus.zul.atcom.xhui.vimarket.zkplustrTextComposer", parentComp);
    com.xhui.vimarket.zkplustextboxPlus;
            // return "<textbox use=\"com.xhui.vimarket.zkplus.zul.textbox.TextboxPlus\" apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrTextComposer\" />";
        } else if (Acom.xhui.vimarket.zkplusE_INT.equals(displayMode)) {
            Intbox intbox = new Intbox();
            ComposerUtil.bindComposer(intbox, "com.xhui.vimarkecom.xhui.vimarket.zkplustr.evt.rtime.AttrIntComposer",
                parentComp);
            return intbox;
            // return "<intbox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrIntComposer\" />";
        } else icom.xhui.vimarket.zkplus.MODE_DOUBLE.equals(displayMode)){
            Doublebox doublebox = new Doublebox();
            ComposerUtil.bindComposer(doublebox, "com.xhucom.xhui.vimarket.zkplusus.zul.attr.evt.rtime.AttrDoubleComposer",
                parentComp);
            return doublebox;
            // return "<doublebox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrDoubleComposer\" />";
      com.xhui.vimarket.zkplustrTmplImpl.MODE_TIME.equals(displayMode)) {
            Timebox timebox = new Timebox();
            ComposerUtil.bindCocom.xhui.vimarket.zkplus
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrTimeComposer", parentComp);
            return timebox;
            // return "<timebox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrTimeComposer\" />";
        } else if (AttrTmplImpl.MODE_CHECKBOX.equals(com.xhui.vimarket.zkplus AttrTmplImpl.MODE_CHECKBOX_BYINST.equals(displayMode)) {
            Checkbox checkbox = new Checkbox();
            Composercom.xhui.vimarket.zkpluser(checkbox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrCheckboxComposer", parentComp);
            return checkbox;
            // return "<checkbox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.Attcom.xhui.vimarket.zkpluser\" />";
        } else if (AttrTmplImpl.MODE_PASSWORD.equals(displayMode)) {
            Textbox textbox = new Textbox();com.xhui.vimarket.zkplusmposerUtil.bindComposer(textbox,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrPasswordComposer", parentComp);
            return textbox;
            // return "<textbox apply=\"com.xhui.vimarket.zkplus.zul.attr.evtcom.xhui.vimarket.zkpluswordComposer\" />";
        } else if (AttrTmplImpl.MODE_SELECTTREE.equals(displayMode)) {
            Tree attrValueTree = new Tree();
            ComposerUtil.bindComposer(attrValueTree,
                "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrTreeComposer", parentComp);
            return attrValueTree;
        }
        return super.getAttrTmplCompStr(displayMode, attrTmpl, sComposer, param1, param2,
            parentComp);
    }
    
    @Override
    public boolean isCreateNullAttrInst(final String displayMode, final AttrTmpl attrTmpl) {
        return super.isCreateNullAttrInst(displayMode, attrTmpl);
    }
    
    @Override
    public Component getAttrPasswocom.xhui.vimarket.zkplustring displayMode, AttrTmpl attrTmpl,
        String sComposer, String param1, String param2, Component parentComp) {
 com.xhui.vimarket.zkplustextbox = new Textbox();
        ComposerUtil.bindComposer(textbox,
            "com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrPasswordTwoComposer", parentComp);
        return textbox;
        // return "<textbox apply=\"com.xhui.vimarket.zkplus.zul.attr.evt.rtime.AttrPasswordTwoComposer\" />";
    }
    
}
